from artifacts.base.artifacts_impl import *
from artifacts.base.attr_type import AttrType

need_main_attr = {
    Flower: AttrType.HP,
    Plume: AttrType.ATK,
    Clock: AttrType.ATK_P,
    Cup: AttrType.CRYO_DMG,
    Head: AttrType.CRIT_RATE
}

bonus_attr_score = {
    AttrType.ATK_P: 0.99,
    AttrType.CRIT_RATE: 1,
    AttrType.CRIT_DMG: 1,
    AttrType.ATK: 0.3,
    AttrType.ENERGY: 0.3
}


def evaluate(artifacts):
    score = 0
    if artifacts.main_attr is not need_main_attr[type(artifacts)]:
        return score
    for item in artifacts.bonus_attr_list:
        s = bonus_attr_score.get(item.type)
        if s is not None:
            score += s
    return score
